package models;

import com.avaje.ebean.Model;
import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonManagedReference;
import play.data.validation.Constraints;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Supplier entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "supplier")
public class Supplier extends Model {
    @Id
    @Constraints.Min(10)
	public Long supplierId;

	public String supplierName;

	public String supplierPhone;

	public String supplierMail;

	public String supplierAddr;

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "supplier")
	@JsonBackReference
	public Set<Product> products = new HashSet<Product>(0);

    public static Model.Finder<Long, Supplier> find = new Model.Finder<>(Supplier.class);
}